/*
 * @Author: zhangwenbangde@163.com
 * @Date: 2019-04-18 15:49:29
 * */
const proxy = require('./src/env/proxy');
const proxyPath = proxy.proxyPath;

const staticPath = require('./src/env/static');

const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

module.exports = {
  // eslint-loader 是否在保存的时候检查
  lintOnSave: true,
  publicPath: staticPath,
  devServer: {
    host: '0.0.0.0',
    port: 3000,
    open: true,
    proxy: {
      [proxyPath]: {
        // target: 'http://sd.auto1768.com/ShengDaXingTu/',
        target: 'http://sd.ssdlqcfw.com/ShengDaXingTu/',
        changeOrigin: true,
        ws: true
        /* pathRewrite: {
          '^/api': ''
        } */
      }
    }
  },
  configureWebpack: {
    optimization: {
      minimizer: [
        new UglifyJsPlugin({
          uglifyOptions: {
            compress: {
              warnings: false,
              drop_debugger: true,
              drop_console: true,
              pure_funcs: ['console.log'] // 移除console
            }
          }
        })
      ]
    }
  },

  // transpileDependencies: process.env.NODE_ENV === 'production' ? ['vue-qr'] : [],
  // 生产环境是否生成 sourceMap 文件
  productionSourceMap: true
};